package com.shilei.strategy;

import java.util.Arrays;

/**
 * @description: 策略模式
 * @author: 81271
 * @date: 2020-04-12 11:04
 */
public class Main {
    public static void main(String[] args) {
        Cat[] cats = {new Cat(5, 10), new Cat(7, 1), new Cat(3, 15)};
        Sorter<Cat> catSorter = new Sorter<>();
        catSorter.sort(cats, (t1, t2) -> {
            if (t1.height < t2.height) return -1;
            else if (t1.height > t2.height) return 1;
            return 0;
        });
        System.out.println(Arrays.toString(cats));
     }
}
